import multiprocessing as mp
import time


# 定义任务函数
def task1():
    for i in range(10):
        print(mp.current_process(), "task1 rum **")
        time.sleep(0.2)


def task2():
    for i in range(10):
        print(mp.current_process(), "task2 rum **")
        time.sleep(0.2)


# 创建任务函数
def create_task():
    p1 = mp.Process(target=task1, name="my-proces-1")
    p2 = mp.Process(target=task2)
    p1.start()
    p2.start()
    print("maid:", mp.current_process())


if __name__ == '__main__':
    create_task()
